#!/bin/bash

# Build script for Linux/macOS

echo "Building Hysteria Rust..."

# Build Rust backend
echo ""
echo "Building backend..."
cargo build --release

if [ $? -ne 0 ]; then
    echo "Backend build failed!"
    exit 1
fi

# Build frontend
echo ""
echo "Building frontend..."
cd web
npm install
npm run build

if [ $? -ne 0 ]; then
    echo "Frontend build failed!"
    exit 1
fi

cd ..

echo ""
echo "Build completed successfully!"
echo "Binary: target/release/hysteria"
echo "Web files: web/dist"
